<!--
 * @Author: 灰灰
 * @Date: 2021-12-27 22:14:32
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-01-07 16:28:24
-->
<template>
  <page-box pageType="2">
    <div>
      <el-divider content-position="left">下载文件</el-divider>
      <el-button type="primary">下载</el-button>
    </div>
    <el-row :gutter="20">
      <el-divider content-position="left">table 导出excel</el-divider>
      <el-button type="primary"
                 @click="exportClick">导出excel</el-button>
      <common-table ref="tableRef"
                    indexName="序号"
                    :dataList="dataList"
                    :tableCols="cols"></common-table>
    </el-row>
  </page-box>
</template>

<script>

export default {
  data () {
    return {
      cols: [],
      dataList: []
    }
  },
  mounted () {
    this.cols.push({
      prop: 'year',
      label: '年',
      filterType: 'decimal',
      format: '0.0'
    })
    this.cols.push({
      prop: 'month',
      label: '月',
      filterType: 'percent'
    })
    this.cols.push({
      prop: 'day',
      label: '日',
      filterType: 'percent2',
      format: '0.0%'
    })
    this.cols.push({
      prop: 'time',
      label: '时间',
      filterType: 'timeFormat'
    })

    this.dataList.push({
      year: '2018',
      month: '1',
      day: '22',
      time: '2019-10-10'
    });
    this.dataList.push({
      year: '2020',
      month: '10',
      day: '100',
      time: '1641532600000'
    })
  },
  methods: {
    exportClick () {
      this.$refs.tableRef.exportFile('title', () => {
      })
    }
  }
}
</script>

<style>
</style>